using System;

namespace ERP.ERPSystem.WarehouseManagement.Dto
{
    /// <summary>
    /// 节假日设置DTO
    /// </summary>
    public class HolidaysSetDto
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 节假日日期
        /// </summary>
        public DateTime HolidaysTime { get; set; }

        /// <summary>
        /// 节假日类型
        /// </summary>
        public string HolidaysType { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 节假日日期字符串格式
        /// </summary>
        public string HolidaysTimeString 
        { 
            get 
            {
                try
                {
                    return HolidaysTime.ToString("yyyy-MM-dd");
                }
                catch
                {
                    return DateTime.MinValue.ToString("yyyy-MM-dd");
                }
            }
        }

        /// <summary>
        /// 节假日日期ISO格式字符串（用于前端处理）
        /// </summary>
        public string HolidaysTimeIso 
        { 
            get 
            {
                try
                {
                    return HolidaysTime.ToString("yyyy-MM-dd");
                }
                catch
                {
                    return DateTime.MinValue.ToString("yyyy-MM-dd");
                }
            }
        }

        /// <summary>
        /// 节假日类型显示名称
        /// </summary>
        public string HolidaysTypeDisplay
        {
            get
            {
                return HolidaysType switch
                {
                    "假" => "假",
                    "班" => "班",
                    "holiday" => "法定节假日",
                    "workday" => "调休工作日",
                    "weekend" => "周末",
                    _ => HolidaysType
                };
            }
        }
    }
} 